import UIManager from "../../engine/UIManager";
import ViewBase from "../../engine/ViewBase";
import { ViewConfig } from "../config/ViewConfig";
import { UIHelper } from "../util/UIHelper";

const { ccclass, property } = cc._decorator;

@ccclass
export default class ViewHallJinDou extends ViewBase {


    onEnable(): void {
        super.onEnable()

        let btnBack: cc.Node = this.findChild(this.node, "btnBack")
        UIHelper.onAddEvent(btnBack, () => {
            this.closeView()
            UIManager.instance.showView(ViewConfig.viewConfig.ViewHall)
        })

        for (let i = 0; i < 6; i++) {
            let btnGame: cc.Node = this.findChild(this.node, "btnGame"+i)
            UIHelper.onAddEvent(btnGame, ()=>{
                UIManager.instance.showView(ViewConfig.viewConfig.ViewCoinGame, ()=>{
                    this.closeView()
                }, i+1)
            })
        }
    }

}
